package org.ilead.iserve.web;

import java.util.List;

import net.sf.json.JSONArray;

import org.apache.log4j.Logger;
import org.ilead.iserve.model.HelpCategory;
import org.ilead.iserve.service.IHelpCategoryService;
import org.springframework.beans.factory.annotation.Autowired;

import com.opensymphony.xwork2.ActionSupport;

public class HelpCategoryAction extends ActionSupport {
	Logger logger = Logger.getLogger(HelpCategoryAction.class);
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	@Autowired
	private IHelpCategoryService helpCategoryService; 
	private List<HelpCategory> helpCategoryList;
	JSONArray helpCategoryJSONArray;
	Long categoryPid;
	public String listHelpCategory()throws Exception{
		helpCategoryList = helpCategoryService.findByCategoryPid(categoryPid);
		helpCategoryJSONArray = JSONArray.fromObject(helpCategoryList);
		return "json";
	}
	public void setHelpCategoryService(IHelpCategoryService helpCategoryService) {
		this.helpCategoryService = helpCategoryService;
	}
	public List<HelpCategory> getHelpCategoryList() {
		return helpCategoryList;
	}
	public void setHelpCategoryList(List<HelpCategory> helpCategoryList) {
		this.helpCategoryList = helpCategoryList;
	}
	public JSONArray getHelpCategoryJSONArray() {
		return helpCategoryJSONArray;
	}
	public void setHelpCategoryJSONArray(JSONArray helpCategoryJSONArray) {
		this.helpCategoryJSONArray = helpCategoryJSONArray;
	}
	public Long getCategoryPid() {
		return categoryPid;
	}
	public void setCategoryPid(Long categoryPid) {
		this.categoryPid = categoryPid;
	}
}
